package com.sky.mapper.admin;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.DishDTO;
import com.sky.dto.DishPageQueryDTO;
import com.sky.enumeration.OperationType;
import com.sky.pojo.Dish;
import com.sky.result.PageResult;
import com.sky.vo.DishSelectIdVO;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

@Mapper
public interface DishMapper {
    Page<DishVO> selectPageCategory(DishPageQueryDTO dto);

    List<DishSelectIdVO> selectId(Integer categoryId);
    @AutoFill(OperationType.INSERT)
    int insertDish( Dish dto);

    DishVO selectByIdDishAll(Long id);
    @AutoFill(OperationType.UPDATE)
    int updateDishAll(Dish dish);

    int deletByIdDishAll(@Param("list") List<Long> ids);
     @Select("select * from dish where category_id=#{id} and status=1 ")
     List<Dish> selectByCategoryId(Long id);

@Select("select * from dish where id=#{dishId}")
    Dish getByIdDish(Long dishId);
    @Select("select * from setmeal where id=#{setmealId}")
    Dish getByIdSetmeal(Long setmealId);
}
